﻿@model ShipmentDetailsModel
@using Nop.Core.Domain.Orders;
@using Nop.Web.Models.Order;
@using Nop.Services.Localization;
@{
    Layout = "~/Views/Shared/_Layout.cshtml";
    //title
    Html.AddTitleParts(T("PageTitle.ShipmentDetails").Text);
}
<div class="shipping-details-container col-xxs-12 col-xs-12 col-sm-10 col-sm-offset-1 col-md-10 col-md-offset-1 col-lg-10 col-lg-offset-1">
    <div class="col-xxs-12 col-xs-12 col-sm-12 col-md-12 col-lg-12">
        <div class="col-xxs-6 col-xs-6 col-sm-6 col-md-6 col-lg-6">
            <h2>@string.Format(T("Order.Shipments.Information").Text, Model.Id)</h2>
        </div>
        <div class="col-xxs-6 col-xs-6 col-sm-6 col-md-6 col-lg-6 text-right back-to-order-details-button">
            <button type="button" class="btn" onclick="goBackOrderDetails()"><i class="fa fa-arrow-circle-o-left"></i>&nbsp;&nbsp;Back to Order Details</button>
        </div>

    </div>
    <div class="page-body">
        <div class="col-xxs-12 col-xs-12 col-sm-12 col-md-12 col-lg-12">
            <div class="col-xs-12 col-sm-6 col-md-6 col-lg-6 shipping-order-container">
                <h2>
                    @T("Order.Shipments.Order#")@Model.Order.Id
                </h2>
                <div class="shipping-method">@T("Order.Shipments.ShippingMethod"): @Model.Order.ShippingMethod</div>
                <div class="shipped-date">
                    @T("Order.Shipments.ShippedDate"):
                    @if (Model.ShippedDate.HasValue)
                    {
                        @Model.ShippedDate.Value.ToString("D")
                    }
                    else
                    {
                        @T("Order.Shipments.ShippedDate.NotYet")
                    }
                </div>
                <div class="delivery-date">
                    @T("Order.Shipments.DeliveryDate"):
                    @if (Model.DeliveryDate.HasValue)
                    {
                        @Model.DeliveryDate.Value.ToString("D")
                    }
                    else
                    {
                        @T("Order.Shipments.DeliveryDate.NotYet")
                    }
                </div>
                @if (!String.IsNullOrEmpty(Model.TrackingNumber))
                {
                    <div class="tracking-number">
                        @T("Order.Shipments.TrackingNumber"):
                        @if (!string.IsNullOrEmpty(Model.TrackingNumberUrl))
                        {
                            <a href="@Model.TrackingNumberUrl" target="_blank" class="tracking-url">@Model.TrackingNumber</a>
                        }
                        else
                        {
                            @Model.TrackingNumber
                        }
                    </div>
                }
            </div>

            <div class="col-xs-12 col-sm-6 col-md-6 col-lg-6 shipping-address-container">

                <div class="shipping-address">
                    <h2>@T("Order.Shipments.ShippingAddress")</h2>
                    <div class="name">
                        <b>@Model.Order.ShippingAddress.FirstName @Model.Order.ShippingAddress.LastName</b>
                    </div>
                    @if (!String.IsNullOrEmpty(Model.Order.ShippingAddress.Company))
                    {
                        <div class="company">
                            @Model.Order.ShippingAddress.Company
                        </div>
                    }
                    <div class="address1">
                        @Model.Order.ShippingAddress.Address1
                    </div>
                    @if (!String.IsNullOrEmpty(Model.Order.ShippingAddress.Address2))
                    {
                        <div class="address2">
                            @Model.Order.ShippingAddress.Address2
                        </div>
                    }
                    <div class="city-state">
                        @Model.Order.ShippingAddress.City,
                        @Model.Order.ShippingAddress.StateProvinceName
                    </div>
                    @if (!String.IsNullOrEmpty(Model.Order.ShippingAddress.CountryName))
                    {
                        <div class="country-zip">
                            @Model.Order.ShippingAddress.CountryName
                            @Model.Order.ShippingAddress.ZipPostalCode
                        </div>
                    }
                    <div class="email">
                        @Model.Order.ShippingAddress.Email
                    </div>
                    @if (Model.Order.ShippingAddress.CellPhoneEnabled)
                    {
                        <div class="phone">
                            @Model.Order.ShippingAddress.CellPhoneNumber
                        </div>
                    }
                    @if (Model.Order.ShippingAddress.PhoneEnabled)
                    {
                        <div class="phone">
                            @Model.Order.ShippingAddress.PhoneNumber
                        </div>
                    }
                   

                            </div>
                        </div>
                    </div>
                            <div class="clear">
                            </div>
                            @if (Model.Items.Count > 0)
            {
                                <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
                                    <div class="products">
                                        <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
                                            <h2>@T("Order.Shipments.Product(s)")</h2>
                                        </div>
                                        <div class="products-box col-xs-12 col-sm-12 col-md-12 col-lg-12">
                                            <table class="data-table table">
                                                <thead>
                                                    <tr>
                                                        @if (Model.ShowSku)
                                        {
                                                            <th class="a-center">
                                                                @T("Order.Shipments.Product(s).SKU")
                                                            </th>
                                        }
                                                        <th></th>
                                                        <th class="a-center">
                                                            @T("Order.Shipments.Product(s).Name")
                                                        </th>
                                                        <th class="a-center">
                                                            @T("Order.Shipments.Product(s).Quantity")
                                                        </th>

                                                    </tr>
                                                </thead>
                                                <tbody>
                                                    @foreach (var item in Model.Items)
                                    {
                                                        <tr>
                                                            @if (Model.ShowSku)
                                            {
                                                                <td class="a-left">
                                                                    @item.Sku
                                                                </td>
                                            }

                                                            <td class="a-left-">
                                                                @*<img alt="@item.PictureModel.AlternateText" src="@item.PictureModel.ImageUrl" title="@item.PictureModel.Title" />*@

                                                                Product Picture here
                                                            </td>
                                                            <td class="a-left">
                                                                <em><a href="@Url.RouteUrl("Product", new { SeName = item.ProductSeName })" title="View details">@item.ProductName</a></em>
                                                                @if (!String.IsNullOrEmpty(item.AttributeInfo))
                                                {
                                                                    <div class="attributes">
                                                                        @Html.Raw(item.AttributeInfo)
                                                                    </div>
                                                }
                                                            </td>
                                                            <td class="a-center">
                                                                @item.QuantityShipped
                                                            </td>
                                                        </tr>
                                    }
                                                </tbody>
                                            </table>
                                        </div>
                                    </div>
                                    <div class="clear">
                                    </div>
                                </div>
            }
                            <div class="clear">
                            </div>

                            @Html.Partial("_ShipmentEvents", Model)
                        </div>
                    </div>
                
                <div class="clear"></div>
                <script>
                    function goBackOrderDetails() {
                        window.history.back();
                    }
                </script>